
from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory  
import os   
def generate_launch_description():
   
    # 获取YAML文件绝对路径  
    config_path = os.path.join(  
        get_package_share_directory('laser_odometry'),  
        'config',  
        'laser.yaml'  
    )  

    # 创建节点配置 
    laser_tf = Node(
            package='laser_odometry',
            executable='laser_to_tf',
            name='laser_to_tfm',   #这个一定要和yaml文件第一行对应！
            parameters=[config_path],  # 关键参数注入  
            remappings=[
                ('/ros_robot/odom','/odom')
            ]
    )
   
    return LaunchDescription([laser_tf])